﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Text;

namespace NGS.BioSequenceIO
{
    class FastaFileWriter
    {
        StreamWriter sw;
        public FastaFileWriter(string filename)
        {
            sw = new StreamWriter(filename);
        }
        public void OutputSequence(Sequence seq)
        {
            int i;
            sw.WriteLine(seq.caption);
            for (i = 0; i < seq.bases.Length - 60; i += 60)
            {
                sw.WriteLine(seq.bases.Substring(i, 60));
            }
            sw.WriteLine(seq.bases.Substring(i));
        }
        public void Close()
        {
            sw.Flush();
            sw.Close();
        }
    }
}
